﻿using System;

namespace _71_泛型参数的输入与输出_泛型
{
    class Program
    {
        static void Main(string[] args)
        {

            //逆变
            ITest1<FootBall> t1 = new Test1<Ball> ();

            //协变
            ITest2<Ball> t2 = new Test2<FootBall>();

        }
    }

    public class Ball { }
    public class FootBall : Ball { }


    //声明两个带可类型参数的泛型接口
    public interface ITest1<in T> { }
    public interface ITest2<out T> { }

    //声明两个类，分别实现ITest1和ITest2接口
    public class Test1<T> : ITest1<T> { }
    public class Test2<T> : ITest2<T> { }
}
